package org.marverse.util

import scala.collection.mutable.Map

class MutableTypedProxyMap[K[T] <: TypedKey[T], V](map: Map[K[_], V]) extends MutableTypedMap[K, V] {

  def -= (key: K[_]) { map -= key }
  def update[V1 <: V](key: K[V1], value: V1) { map.update(key, value) }
  def get[V1](key: K[V1]): Option[V1] = { 
    map.get(key) match {
      case Some(x) => Some(key.valueClass.cast(x))
      case _ => None
    }
  }
  def size: Int = map.size
  def elements: Iterator[(K[_], V)] = map.elements
  
}
